﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Testing_components
{
    public class PresentableRule : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private string _name;
        private string _description;
        private bool _status = true;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public ObservableCollection<ConditionOpPair> Conditions { get; set; }

        public string Name
        {
            get { return _name; }
            set
            {
                if (_name != value) _name = value;
                OnPropertyChanged("Name");
            }
        }

        public string Status
        {
            get { return _status ? "Active" : "Disabled"; }
            set
            {
                if (value == "Active") _status = true; else _status = false;
                OnPropertyChanged("Status");
            }
        }

        public string Description
        {
            get { return _description; }
            set
            {
                if (_description != value) _description = value;
                OnPropertyChanged("Description");
            }
        }
    }
}
